<template>
  <router-view />
  <NavBar v-if="show" />
</template>

<script>
import { reactive, toRefs } from "vue";
import { useRouter } from "vue-router";
import NavBar from "./components/NavBar.vue";
export default {
  name: "App",
  components: {
    NavBar,
  },
  setup() {
    const state = reactive({
      menu: ["/home", "/data", "/user"],
      show: false,
    });
    const router = useRouter();
    router.afterEach(() => {
      state.show = state.menu.includes(router.currentRoute.value.path);
    });
    return {
      ...toRefs(state)
    };
  },
};
</script>